﻿using System;
using System.Windows.Forms;
using Sims3Package;
using Sims3Package.Interface;
using System.IO;

namespace PackageEditor
{
    public class ListViewItemEx : ListViewItem, IResourceEntry
    {
        internal ResourceEntry entry;

        public uint ResourceType { get { return entry.ResourceType; } set { entry.ResourceType = value; } }
        public uint ResourceGroup { get { return entry.ResourceGroup; } set { entry.ResourceGroup = value; } }
        public ulong ResourceInstance { get { return entry.ResourceInstance; } set { entry.ResourceInstance = value; } }
        public TGIOrder Order { get { return entry.Order; } set { entry.Order = value; } }
        public Int32 FileSize { get { return entry.FileSize; } }
        public Int32 Memsize { get { return entry.Memsize; } }
        public bool Compressed { get { return entry.Compressed; } set { entry.Compressed = value; } }
        public Int32 Chunkoffset { get { return entry.Chunkoffset; } set { entry.Chunkoffset = value; } }
        public byte Unknown1 { get { return entry.Unknown1; } set { entry.Unknown1 = value; } }
        public UInt16 Unknown2 { get { return entry.Unknown2; } set { entry.Unknown2 = value; } }
        public byte[] GetIndexBytes(Int32 type) { return entry.GetIndexBytes(type); }
        public void Dispose() { entry.Dispose(); }

        public ListViewItemEx(ResourceEntry entry) : base() { this.entry = entry; entry.Chunkoffset = int.MaxValue; }
        public ListViewItemEx(ResourceEntry entry, string name) : base(name) { this.entry = entry; }

        private Stream mResourceStream = null;
        public Stream ResourceStream { get { return mResourceStream; } set { mResourceStream = value; } }
        
    }
}
